package cn.edu.tju.core.model;

public enum ResultCodeEnum {
    /*** 通用部分 100 - 599***/
    // 成功请求
    SUCCESS("OK", "successful"),
    // 资源未找到
    NOT_FOUND("NOT_FOUND", "not found"),
    // 服务器错误
    SERVER_ERROR("GENERAL_ERROR","server error"),
    // 购物车为空
    CART_EMPTY("CART_4001", "购物车为空"),

    USER_NOT_FOUND("USER_NOT_FOUND", "用户不存在"),

    USERNAME_EXISTS("USERNAME_EXISTS", "用户名已存在"),

    REGISTRATION_FAILED("REGISTRATION_FAILED", "注册失败"),

    ORDER_NOT_FOUND("ORDER_NOT_FOUND", "订单不存在"),

    ADDRESS_NOT_EXISTS("ADDRESS_NOT_FOUND", "配送地址不存在"),

    FOOD_NOT_FOUND("FOOD_NOT_FOUND","商品不存在"),

    BUSINESS_NOT_FOUND("BUSINESS_NOT_FOUND","商家不存在"),

    FOOD_ID_NULL("FOOD_ID_NULL","商品id不能为空"),

    FOOD_QUANTITY_ERROR("FOOD_QUANTITY_ERROR","商品数量应>0"),

    BUSINESS_ID_NULL("BUSINESS_ID_NULL","商家id不能为空"),

    CART_ITEM_NOT_FOUND("CART_ITEM_NOT_FOUND","购物车中不存在该商品"),

    BUSINESS_APPLICATION_NOT_FOUND("BUSINESS_APPLICATION_NOT_FOUND","开店申请不存在"),

    CANNOT_MODIFY_REVIEWED_APPLICATION("CANNOT_MODIFY_REVIEWED_APPLICATION","已审核的申请不能修改"),

    UNAUTHORIZED_APPLICATION_ACCESS("UNAUTHORIZED_APPLICATION_ACCESS","无权访问该开店申请"),

    FORBIDDEN("FORBIDDEN","没有权限"),

    UNAUTHORIZED("UNAUTHORIZED", "未授权访问"),

    PARAM_ERROR("PARAM_ERROR", "参数错误"),

    NOT_LOGGED_IN("NOT_LOGGED_IN","未登录"),

    SUBMIT_APPLICATION_ERROR("SUBMIT_APPLICATION_ERROR","提交开店申请失败"),

    UPDATE_APPLICATION_ERROR("UPDATE_APPLICATION_ERROR","更新开店申请失败"),

    UNAUTHORIZED_OPERATION("UNAUTHORIZED_OPERATION","无权限的操作"),

    ADDRESS_NOT_FOUND("ADDRESS_NOT_FOUND","地址不存在"),


    /*** 这里可以根据不同模块用不同的区级分开错误码，例如:  ***/

    // 1000～1999 区间表示用户模块错误
    // 2000～2999 区间表示订单模块错误
    // 3000～3999 区间表示商品模块错误
    // 。。。

    ;
    /**
     * 响应状态码
     */
    private String code;
    /**
     * 响应信息
     */
    private String message;

    ResultCodeEnum(String code, String msg) {
        this.code = code;
        this.message = msg;
    }

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }
}
